CentOS 6
Sponsored Link

OpenStack Grizzly - Use Virtual Storage(NFS)
2013/08/18
 
It's possible to use Virtual Storage provided by Cinder for Virtual Machine Instance.
This example shows to set to use NFS for Virtual Storage. If you've already set LVM for Virtual Storage, unset it first.
[1]
Configure NFS Server in your LAN first.
This example uses a shared directory "/storage" provided by NFS.
[2] Set idmapd
[root@dlp ~(keystone)]#
vi /etc/idmapd.conf
# line 5: uncomment and chnage your domain name

Domain =
srv.world
[root@dlp ~(keystone)]#
/etc/rc.d/init.d/rpcidmapd restart

Stopping RPC idmapd: [ OK ]
Starting RPC idmapd: [ OK ]
[3] Configure Cinder
[root@dlp ~(keystone)]#
vi /etc/cinder/cinder.conf
# near line 11: add follows

volume_driver = cinder.volume.drivers.nfs.NfsDriver
nfs_shares_config = /etc/cinder/nfs.shares
nfs_mount_point_base = /var/lib/cinder/mnt
[root@dlp ~(keystone)]#
vi /etc/cinder/nfs.shares
# create new : specify NFS shared directory

10.0.0.100:/storage
[root@dlp ~(keystone)]#
chgrp cinder /etc/cinder/nfs.shares

[root@dlp ~(keystone)]#
mkdir /var/lib/cinder/mnt

[root@dlp ~(keystone)]#
chown cinder. /var/lib/cinder/mnt

[root@dlp ~(keystone)]#
/etc/rc.d/init.d/openstack-cinder-volume restart

Stopping openstack-cinder-volume: [ OK ]
Starting openstack-cinder-volume: [ OK ]
[4] For example, create a volume named "disk01", 10GB.
[root@dlp ~(keystone)]#
cinder create --display_name disk01 10

+---------------------+--------------------------------------+
|       Property      |                Value                 |
+---------------------+--------------------------------------+
|     attachments     |                  []                  |
|  availability_zone  |                 nova                 |
|       bootable      |                false                 |
|      created_at     |      2013-08-18T14:31:49.980773      |
| display_description |                 None                 |
|     display_name    |                disk01                |
|          id         | 7051038a-385a-4ed6-bf90-9de0a47f60d1 |
|       metadata      |                  {}                  |
|         size        |                  10                  |
|     snapshot_id     |                 None                 |
|     source_volid    |                 None                 |
|        status       |               creating               |
|     volume_type     |                 None                 |
+---------------------+--------------------------------------+

[root@dlp ~(keystone)]#
cinder list

+--------------------------------------+-----------+--------------+------+-------------+----------+-------------+
|                  ID                  |   Status  | Display Name | Size | Volume Type | Bootable | Attached to |
+--------------------------------------+-----------+--------------+------+-------------+----------+-------------+
| 7051038a-385a-4ed6-bf90-9de0a47f60d1 | available |    disk01    |  10  |     None    |  false   |             |
+--------------------------------------+-----------+--------------+------+-------------+----------+-------------+
[5] Attach the volume just created to Instance.
The following example just attached to the Instance as "/dev/vdb".
[root@dlp ~(keystone)]#
nova list

+--------------------------------------+---------+---------+--------------------+
| ID                                   | Name    | Status  | Networks           |
+--------------------------------------+---------+---------+--------------------+
| 96676b36-d13f-4f13-89ab-f269b3f28273 | CentOS6 | SHUTOFF | network01=10.1.0.2 |
+--------------------------------------+---------+---------+--------------------+

[root@dlp ~(keystone)]#
nova volume-attach CentOS6 7051038a-385a-4ed6-bf90-9de0a47f60d1 auto

+----------+--------------------------------------+
| Property | Value                                |
+----------+--------------------------------------+
| device   | /dev/vdb                             |
| serverId | 96676b36-d13f-4f13-89ab-f269b3f28273 |
| id       | 7051038a-385a-4ed6-bf90-9de0a47f60d1 |
| volumeId | 7051038a-385a-4ed6-bf90-9de0a47f60d1 |
+----------+--------------------------------------+
[6] By the way, it's possible to operate create or attach, dettach volumes on the DashBoard.
 
Tweet